package com.ai.controller.made;


import com.ai.annotation.EnterPathParamLog;
import com.ai.common.CommonResponse;
import com.ai.entity.cameraFunctions.CameraFunctionID;
import com.ai.entity.cameraFunctions.regions.RegionsBO;
import com.ai.service.made.RegionsService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *  画图roi框接口
 * @author Mr.Chen
 * @since 2020-08-14
 */
@RestController
@Slf4j
@RequestMapping("/regions")
public class RegionsController {

    @Autowired
    private RegionsService regionsService;

    /**
     * 列表
     * @return
     */
    @ApiOperation("区域列表")
    @PostMapping("list")
    @EnterPathParamLog
    public CommonResponse  regionsList(@RequestBody CameraFunctionID cameraFunctionID){
        CommonResponse resultData = regionsService.regionsList(cameraFunctionID);
        log.info(resultData.toString());
        return resultData;
    }

    /**
     * 新增区域
     * @return
     */
    @ApiOperation("新增区域")
    @PostMapping("add")
    @EnterPathParamLog
    public CommonResponse  add(@RequestBody RegionsBO regionsBO){
        CommonResponse resultData = regionsService.add(regionsBO);
        log.info(resultData.toString());
        return resultData;
    }



    /**
     * 上传提交区域绑定
     */
    @ApiOperation("上传提交区域绑定")
    @PostMapping("binding")
    @EnterPathParamLog
    public CommonResponse binding(@RequestBody RegionsBO regionsBO) {
        CommonResponse resultData = regionsService.binding(regionsBO);
        log.info(resultData.toString());
        return resultData;
    }

    /**
     * 上传提交区域删除
     */
    @ApiOperation("上传提交区域删除")
    @PostMapping("unbound")
    @EnterPathParamLog
    public CommonResponse unbound(@RequestBody RegionsBO regionsBO) {
        CommonResponse resultData = regionsService.unbound(regionsBO);
        log.info(resultData.toString());
        return resultData;
    }
}

